module.exports = (app) => {
  const { Schema, model: createModel, getModelName, formatDate } = app.jax.mongoose
  const modelName = getModelName(__filename)

  const schema = new Schema({
    userId: Number, // 用户ID

    mobile: {
      comment: '手机号',
      type: String,
    },

    openId: {
      comment: '用户唯一标识',
      type: String,
    },

    nickname: {
      comment: '用户昵称',
      type: String,
    },

    gender: {
      comment: '性别 0、未知、1、男、2、女',
      type: Number,
      default: 0,
    },

    avatar: {
      comment: '头像',
      type: String,
    },

    country: {
      comment: '国家',
      type: String,
    },

    province: {
      comment: '省份',
      type: String,
    },

    city: {
      comment: '城市',
      type: String,
    },

    unionId: {
      comment: '开放平台的唯一标识符',
      type: String,
    },
  })

  // schema.plugin(app.autoIncrement.plugin, {
  //   model: modelName,
  //   startAt: 1,
  //   field: '_id',
  // })

  const Model = createModel(modelName, schema)

  return Model
}
